{% extends 'inc/layout.twig' %}

{% set pg_name='用户管理' %}

{% block content %}

    <div class="container">
        <div class="row">
            <a href="/user/add" class="btn btn-default btn-sm"><i class="fa fa-user-plus"></i> 添加用户</a>
        </div>

        <div class="row">
                <div class="table-responsive wrap-monitor">

                    <table class="table table-hover">
                        <thead>

                        {% set tb_head=['#','用户名','所属组', '上次登录时间',
                        '上次登录IP','登录次数','注册时间','账户状态'] %}

                        <tr>
                            {% for key in tb_head %}
                                <th>{{ key }}</th>
                            {% endfor %}
                            <th></th>
                        </tr>

                        </thead>

                        <tbody>
                        {% for entity in user_list %}
                            <tr>
                                {% block item_body %}
                                    <td>{{ entity.id }}</td>
                                    <td>{{ entity.username }}</td>
                                    <td>{{ group_list[entity.group_id]['label_zh'] }}</td>
                                    <td>{{ entity.last_login|date('Y-m-d H:i:s') }}</td>
                                    <td>{{ entity.last_login_ip }}</td>
                                    <td>{{ entity.count_login }}</td>
                                    <td>{{ entity.ctime|date('Y-m-d H:i:s') }}</td>
                                    <td>{{ entity.status ==0 ? '<i class="fa fa-circle green"></i>正常' :
                                        '<i class="fa fa-circle mud"></i>禁用' }}</td>
                                {% endblock %}

                                <td>
                                    <ul class="op_icon" data-bundle="{{ bundle_name | default('') }}">
                                        <li>
                                            <a href="javascript:void(0);" class="btn_edit">
                                                <i class="fa fa-edit"></i> 编辑</a>
                                        </li>
                                        <li>
                                            <a class="btn_del" href="javascript:void(0);" data-eid="{{ entity.id }}">
                                                <i class="fa fa-trash red"></i> 删除</a>
                                        </li>
                                    </ul>
                                </td>

                            </tr>
                        {% endfor %}
                        </tbody>
                    </table>
                </div>

        </div>

    </div>

{% endblock %}

{% block plus_js %}
    <script>
        require(['user']);
    </script>
{% endblock %}